Quantifying effect of planting dates on potential potato yield
A crop modeling approach
Background
This R markdown notebook aims to document the simulation exercise performed by Ramírez et al. (2024). The SOLANUM model was used to determine the potential potato yield (Yp) and “roughly” quantify the effect of planting dates on Yp. The model was calibrated using the SOLANUM’s Parameter Estimator and fed with weather data from NASA POWER
SOLANUM model calibration
The SOLANUM model has a tool called Parameter Estimator which translates expert knowledge about the crop phenology into the model parameters. This tool is based on allometric and heuristic methods that relate mathematical functions of the vegetative (canopy cover) and reproductive (tuber partitioning) crop growth with the parameters of the model. This tool is based on the following 3 principles:
- Use generic mathematical functions to describe either canopy cover or tuber formation, regardless of varieties or environmental conditions, but with specific parameters that vary depending on varieties.
- Apply numerical methods to estimate specific parameters by forcing the function to fit a minimum number of data points.
- The pre-defined minimum number of data points needed to fit the functions must be obtained from expert knowledge. This comprises sowing and harvest dates, day of emergence, day of the maximum canopy cover, maximum canopy cover index, day of physiological maturity, and day of tuber initiation.
More details about the Parameter Estimator tool can be found in Harahagazwe et al. (2018).
The Parameter Estimated tool was run with cite. Values of the crop parameters for
both varieties were saved in CropParamsList.Rdata. Let’s
see them in the following R chunk code:
load(url("https://github.com/jninanya/Ramirez-et-al-2024/raw/main/solanumR/CropParamsList.Rdata"))
CropParamsList$BariAlu72
## wmax tm te A tu b RUE DMc
## 0.90 330.00 870.00 0.75 650.00 190.00 3.22 0.20
## attr(,"CropParamsInfo")
## [1] "wmax : Maximum canopy cover index (fraction)"
## [2] "tm : Thermal time at the maximum canopy cover growth rate (C-day)"
## [3] "te : Thermal time at the maximum canopy cover value (C-day)"
## [4] "A : Maximum harvest index (fraction)"
## [5] "tu : Thermal time at maximum tuber partition rate (C-day)"
## [6] "b : Thermal time just before the tuber initiation process (C-day)"
## [7] "RUE : Average radiation use efficiency (g/MJ)"
## [8] "DMc : Dry matter concentration of tubers (fraction)"
## attr(,"VarietyName")
## [1] "BariAlu72"
CropParamsList$BariAlu78
## wmax tm te A tu b RUE DMc
## 0.90 330.00 870.00 0.75 650.00 190.00 3.22 0.20
## attr(,"CropParamsInfo")
## [1] "wmax : Maximum canopy cover index (fraction)"
## [2] "tm : Thermal time at the maximum canopy cover growth rate (C-day)"
## [3] "te : Thermal time at the maximum canopy cover value (C-day)"
## [4] "A : Maximum harvest index (fraction)"
## [5] "tu : Thermal time at maximum tuber partition rate (C-day)"
## [6] "b : Thermal time just before the tuber initiation process (C-day)"
## [7] "RUE : Average radiation use efficiency (g/MJ)"
## [8] "DMc : Dry matter concentration of tubers (fraction)"
## attr(,"VarietyName")
## [1] "BariAlu78"Libraries
# load libraries
library(nasapower)
library(meteor)
library(lubridate)
library(dplyr)
load(url("https://github.com/jninanya/Ramirez-et-al-2024/raw/main/solanumR/CropParamsList.Rdata"))
CropParamsList$BariAlu72## wmax tm te A tu b RUE DMc
## 0.90 330.00 870.00 0.75 650.00 190.00 3.22 0.20
## attr(,"CropParamsInfo")
## [1] "wmax : Maximum canopy cover index (fraction)"
## [2] "tm : Thermal time at the maximum canopy cover growth rate (C-day)"
## [3] "te : Thermal time at the maximum canopy cover value (C-day)"
## [4] "A : Maximum harvest index (fraction)"
## [5] "tu : Thermal time at maximum tuber partition rate (C-day)"
## [6] "b : Thermal time just before the tuber initiation process (C-day)"
## [7] "RUE : Average radiation use efficiency (g/MJ)"
## [8] "DMc : Dry matter concentration of tubers (fraction)"
## attr(,"VarietyName")
## [1] "BariAlu72"
Climate conditions
# defining variables (wvars) and period
wvars <- c("T2M_MAX", "T2M_MIN", "ALLSKY_SFC_SW_DWN")
period <- c("2000-01-01", "2023-12-31")
# coordinates (lon, lat) of the Fultola location
FUL <- c(89.5262, 22.7088)
# getting daily data from NASA POWER
wdata <- get_power(
community = "ag",
lonlat = FUL,
pars = wvars,
dates = period,
temporal_api = "daily"
)
colnames(wdata)[8:10] <- c("TMAX", "TMIN", "SRAD")
wdata$photoperiod <- photoperiod(wdata$DOY, wdata$LAT)
#--- climatic conditions (average by DOY)
smr_mean <- wdata %>%
group_by(DOY) %>%
summarise_at(c("TMAX", "TMIN", "SRAD"), mean, na.rm = TRUE)
smr_q10 <- wdata %>%
group_by(DOY) %>%
summarise_at(c("TMAX", "TMIN", "SRAD"), quantile, probs = 0.10, na.rm = TRUE)
smr_q90 <- wdata %>%
group_by(DOY) %>%
summarise_at(c("TMAX", "TMIN", "SRAD"), quantile, probs = 0.90, na.rm = TRUE)
smr_mean <- smr_mean[1:365,]
smr_q10 <- smr_q10[1:365,]
smr_q90 <- smr_q90[1:365,]
x <- smr_mean$DOY
climate <- apply(smr_mean, 2, rep, 2)
climate <- as.data.frame(climate)
year1 = fromDoy(climate$DOY[1:365], 2021)
year2 = fromDoy(climate$DOY[366:730], 2022)
climate$day <- NULL
climate$month <- NULL
climate$year <- NULL
climate$day[1:365] <- day(year1)
climate$day[366:730] <- day(year2)
climate$month[1:365] <- month(year1)
climate$month[366:730] <- month(year2)
climate$year[1:365] <- year(year1)
climate$year[366:730] <- year(year2)
par(oma = c(4.0, 1.0, 0.5, 0.5), # general margins
mfrow = c(1, 2), # number of sub-figures
mar = c(1 ,0 ,1 ,0), # margins per sub-figure
ps = 10, # text font size
family = "serif", # text family
lwd = 0.5, # line width
las = 1, # style of axis labels
pch = 20 # plotting points
)
#--- plot for minimum and maximum temperature ----------------------------------
plot(x=0, y=0, type = "l", xlim = c(1,365), ylim = c(5,45),
xlab = "", ylab = "Temperature (°C)", axes = FALSE)
box()
axis(1, at = c(15,75,136,197,259,320),
labels = c("JAN","MAR","MAY","JUL","SEP","NOV"))
axis(2, las = 1)
#minimum temperature
polygon(c(x, rev(x)),
c(smr_q90$TMIN, rev(smr_q10$TMIN)), col = "#ffb2b2")
lines(x, smr_mean$TMIN, col = "#FF0000", lwd = 2)
lines(x, smr_q10$TMIN, col = "#ffb2b2")
lines(x, smr_q90$TMIN, col = "#ffb2b2")
#maximum temperature
polygon(c(x, rev(x)),
c(smr_q90$TMAX, rev(smr_q10$TMAX)), col = "#b2b2ff")
lines(x, smr_mean$TMAX, col = "#0000FF", lwd = 2)
lines(x, smr_q10$TMAX, col = "#b2b2ff")
lines(x, smr_q90$TMAX, col = "#b2b2ff")
legend(x = 300, y = 45, legend = c("TMIN", "TMAX"),
col = c("#FF0000", "#0000FF" ), lty = 1, cex = 0.8)
#--- plot for solar radiation --------------------------------------------------
plot(x=0, y=0, type = "l", xlim = c(1,365), ylim = c(0,30),
xlab = "", ylab = "Solar radiation (MJ/m2.day)", axes = FALSE)
box()
axis(1, at = c(15,75,136,197,259,320),
labels = c("JAN","MAR","MAY","JUL","SEP","NOV"))
axis(2, las = 1)
polygon(c(x, rev(x)),
c(smr_q90$SRAD, rev(smr_q10$SRAD)), col = "#e8cfb4")
lines(x, smr_mean$SRAD, col = "#B45F06", lwd = 2)
lines(x, smr_q10$SRAD, col = "#e8cfb4")
lines(x, smr_q90$SRAD, col = "#e8cfb4")Thermal time computing
################################################################################
# 3. Thermal time computing
################################################################################
year0 = 2000
year1 = 2022
n <- as.Date("2023-01-31")-as.Date("2022-11-01")+1
m <- year1-year0+1
#wdata <- wdata[wdata$YEAR>=year0 & wdata$YEAR<=year1,]
out0 <- as.data.frame(matrix(nrow = n, ncol = m))
out1 <- as.data.frame(matrix(nrow = n, ncol = m))
out2 <- as.data.frame(matrix(nrow = n, ncol = m))
yy = seq(year0, year1, by = 1)
# load extra functions
source("https://raw.githubusercontent.com/jninanya/Ramirez-et-al-2024/main/solanumR/thermalTime.R")
weather <- wdata
#for(jj in 1:m){
#
# date0 = as.Date(paste0(yy[jj], "-11-01"))-1
#
# for(ii in 1:n){
#
#
# sDate = as.Date(date0 + ii)
# sDate.name = paste(month(sDate), day(sDate), sep = "-")
# out0[ii, jj] = as.character(sDate)
#
# sowing = sDate
# harvest = sowing + 90
# ndays = as.numeric(harvest-sowing)+1
#
### variety Bari Alu 72
# source("https://raw.githubusercontent.com/jninanya/Ramirez-et-a#l-2024/main/solanumR/BARI-Alu-72.R")
# source("https://raw.githubusercontent.com/jninanya/Ramirez-et-a#l-2024/main/solanumR/Module_PotentialGrowth_V2.0.R")
#
# out1[ii, jj] = ifelse(df$fty[ndays]>20, df$fty[ndays], NA)
#
### variety Bari Alu 78
# source("https://raw.githubusercontent.com/jninanya/Ramirez-et-a#l-2024/main/solanumR/BARI-Alu-78.R")
# source("https://raw.githubusercontent.com/jninanya/Ramirez-et-a#l-2024/main/solanumR/Module_PotentialGrowth_V2.0.R")
#
# out2[ii, jj] = ifelse(df$fty[ndays]>20, df$fty[ndays], NA)
#
# rownames(out0)[ii] = sDate.name
# rownames(out1)[ii] = sDate.name
# rownames(out2)[ii] = sDate.name
# }
#
# colnames(out0)[jj] = yy[jj]
# colnames(out1)[jj] = yy[jj]
# colnames(out2)[jj] = yy[jj]
#
#}
#d1 <- out1
#d2 <- out2
#
#boxplot(t(d1), col = "green", outline = FALSE, las=1,
# ylab = "potential yield (t/ha)")
#
#boxplot(t(d2), col = "red", outline = FALSE, las=1,
# ylab = "potential yield (t/ha)")
#
#
### plot fty by planting date
#x <- 1:92
#fty_mean <- apply(out1, 1, mean, na.rm = TRUE)
#fty_q10 <- apply(out1, 1, quantile, probs = 0.10, na.rm = TRUE)
#fty_q90 <- apply(out1, 1, quantile, probs = 0.90, na.rm = TRUE)
#
#
##--------------------------------------------------
##--------------------------------------------------
#### General figure settings
#par(oma = c(4, 1, 0.5, 0.5), # general margins
# mfrow = c(2, 1), # number of sub-figures
# mar = c(0,3,0,0), # margins per sub-figure
## ps = 10, # text font size
# family = "serif" # text family
## lwd = 0.5, # line width
## las = 1, # style of axis labels
## pch = 20 # plotting points
#)
#
#x=1:90
#y1=d1$`2021`[1:90]
#y2=d2$`2021`[1:90]
#plot(x, y1, type = "l", xlim = c(1,92), ylim = c(23,57),
# xlab = "", ylab = "potential yield (t/ha)", axes = FALSE,
# lwd = 2)
#box()
#lines(x, y2, lwd = 2, col = "gray50")
#
##axis(1, at = c(5,15,25,35,45,55,66,76,86), las = 2,
## labels = c("5-nov","15-nov","25-nov","5-dec","15-dec","25-dec#","5-jan","15-jan","25-jan"))
##axis(1, las = 1, at = seq(5, 90, by=10))
#axis(2, las = 1, at=seq(25,55,by=5))
#abline(v=50, lty = 2, col = "blue")
#abline(v=74, lty = 2, col = "blue")
#
#text(47, 55.5, "ZT", col = "blue")
#text(71, 55.5, "CT", col = "blue")
#
#text(0, 55.5, expression(bold("A")))
#mtext(side=2, text=bquote("yield (t ha"^{"-1"}*")"), cex = 1.5, #line = 2.4)
#
####
#x=1:85
#y1=d1$`2022`[1:85]
#y2=d2$`2022`[1:85]
#plot(x, y1, type = "l", xlim = c(1,92), ylim = c(23,52),
# xlab = "", ylab = "potential yield (t/ha)", axes = FALSE,
# lwd = 2)
#box()
#lines(x, y2, lwd = 2, col = "gray50")
#
#axis(1, at = c(5,15,25,35,45,55,66,76,86), las = 2,
# labels = c("05-nov","15-nov","25-nov","05-dec","15-dec","25-de#c","05-jan","15-jan","25-jan"))
##axis(1, las = 1, at = seq(5, 90, by=10))
#axis(2, las = 1, at=seq(25,50,by=5))
#abline(v=44, lty = 2, col = "blue")
#abline(v=62, lty = 2, col = "blue")
#
#text(41, 51, "ZT", col = "blue")
#text(59, 51, "CT", col = "blue")
#
#text(0, 51, expression(bold("B")))
#
#mtext(side=2, text=bquote("yield (t ha"^{"-1"}*")"), cex = 1.5, #line = 2.4)
#